<?php
if (!isset($_SESSION)) { session_start(); }

//echo $_SESSION["NOMBREUSUARIO"];
//echo $_SESSION["tipouser"];
//echo $_SESSION["tbl_usuario"];
//echo $_SESSION["SUSUARIO"];
  //Archivos incluidos despues de la verificacion por seguridad.
  include_once('../includes/fk_php/funciones.php');
  
  $lenguaje = 'es';
  //include_once('../includes/fk_php/Connections/connection.php');
switch($lenguaje): // Selecion de lenguaje de la apliacion
	case 'es': include_once('../includes/fk_php/lenguaje_es(v2).php'); break;
	case 'en': include_once('../includes/fk_php/lenguaje_es(v2).php');break;
  endswitch;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=Tile_sisname?></title>
  <!-- Common Styles for the examples -->
  <link rel="stylesheet" type="text/css" href="../includes/extjs/resources/css/ext-all.css" />
  <!-- LIBS -->
  <script type="text/javascript" src="../includes/extjs/adapter/ext/ext-base.js"></script>
  <!-- ENDLIBS -->
  <script type="text/javascript" src="../includes/extjs/ext-all.js"></script>
  <script type="text/javascript" src="../includes/extjs/examples.js"></script>
  <script type="text/javascript" src="../includes/extjs/src/locale/ext-lang-<?=$lenguaje?>.js"></script>
  <style type="text/css">
  .profile{
    background:transparent url(../fk_skin/images_encabezado/logositcom.png) no-repeat;
	}
  </style>
  <script type="text/javascript">
  	Ext.BLANK_IMAGE_URL = '../includes/extjs/resources/images/default/s.gif';
  </script>
   <script type="text/javascript">
   
	function Alert_Bloq(){
		//Ext.Msg.alert('Bloqueado','Esta Bloqueado el Usuario! Tendra que usar nuevamente su clave');
		
		var formLogin = new Ext.FormPanel({  
				  defaults: {  
				   width: 220  
				  },  
				  height:120,  
				  layout: 'absolute',  
				  frame: true,  
				  border: true,  
				  bodyStyle: 'padding-left:5px;,padding-top:10px;',   
				  defaultType: 'textfield',  
				  style:'background:#FEFEFE',  
				  labelWidth: 0,  
				  items: [  
								{  
									 xtype: 'label',  
										 y: 5,   
										 x: 5,  
									  text: 'Usuario :',  
									 style: 'color:#777777'  
								},  
								{  
										xtype: 'label',  
										 y: 25,   
										 x: 55,  
									  text: '<?=$_SESSION["NOMBREUSUARIO"]?>',
									 style: 'padding:4px 3px;',
									 style: 'color:#777777'
								},   
								{   
									xtype: 'label',  
										x: 5,  
										y: 55,  
									 text: 'Contraseña :',  
									style: 'color:#777777'  
								},  
								{  
									    x: 5,  
										y: 75,  
									   id: 'password', //campo password  
								inputType: 'password', // el tipo de Input Password ( los caracteres del campo apareceran ocultos)  
									style: 'padding:4px 3px;',  
								blankText: 'Digite su contraseña',  
							   allowBlank: false  
								}  
					]  
		});  
		var window_config;
		if(!window_config){
		 window_config= new Ext.Window({
			title: 'sitcom',
			width: 400,
			height:200,
			modal: true,
			resizable : false,
			layout: 'fit',
			items: [formLogin],
			buttons: [
				{
					text: '<?=Title_cancelar?>',
					width: 78,
					handler: function(){
						window_config.close();
					}
				}
			]
		});
		}
		window_config.show();
		
	}
   
    Ext.onReady(function(){
	
	
	
	function Enviar_Mensajes(titulo,mensaje){
		Ext.example.msg(titulo, mensaje);
	}
	
	clickListener = function (node,event){
		if (isNaN(node.id)){
			try {
				enviar(node.id);
			}catch(e){
			alert("ERROR - index.php \n Funcion : clickListener() \n Error : "+e.description+' \n '+e.message);
			}
		}
		
	};
	
	
	var loader = new Ext.tree.TreeLoader({      //Paso 1  
    url: 'cargar_menu.php'  
	});  
  
	var tree = new Ext.tree.TreePanel({         //Paso 2  
		border: false,
		title:'<?=TitleAdmin_056?>',		
		autoScroll:true, 
		rootVisible:false,
		lines:true,
		autoScroll:true,
		enableDD: true,
		iconCls:'nav',
		listeners: {
			click: {
				fn:clickListener
			}
		},
		loader:loader //para fines did�cticos he creado el TreeLoader a mano  
	});  
  
	var root = new Ext.tree.AsyncTreeNode({ //Paso 3  
		text: '<?=$_SESSION["SUSUARIO"]?>'  
	});  
  
	tree.setRootNode(root);  
	var panel = new Ext.Panel({
		title:'<?=TitleAdmin_056?>',
		width:200,
		height:505,
		layout:'Accordion',
		defaults: { 
          	 collapsible:true, 
        	 titleCollapse: true, 
			 height:230,
			 autoScroll:true
     	},
		renderTo:'Panel',
		items:[tree]
		});
	});
		
	function enviar(archivo){ 
		try{		
			document.getElementById('InfoC').src = archivo;
		} catch(e){alert("ERROR - menu.php \n Funcion : enviar() \n Error : "+e.description+' \n '+e.message);}	
	}
	
	
	function reportes(id_archivo){
					var window_config;
							if(!window_config){
								window_config= new Ext.Window({
									title: '<?=TITLE_AUX_02?>',
									width: "90%",
									height:600,
									modal: true,
									resizable : false,
									collapsible:true,
									tbar:[	'->',
												'<b>Exportar :</b>',
											{
																xtype       : 'combo',
																id          : 'mes',
																labelStyle  : 'font-size:10px;',
																hiddenName  : 'centroIdmes',  
																name        : 'centro_red',  
																loadingText : "Cargando...",
																emptyText   : "Seleccione una forma para exportar...",
																mode        : 'local', 
																allowBlank  : true,
																disabled    : false,
																width       : 250,  
																displayField: 'nomcentro',  
																valueField  : 'idcentro',
																store 		: new Ext.data.SimpleStore({  
																						id      : 0 ,  
																						fields  : [  'idcentro', 'nomcentro' ],  
																						data    : [  
																									['pdf', 'PDF'],  
																									['xls', 'EXCEL'],
																									['txt', 'TXT']
																								]  
																						})
											}
									],
									items: 
											[
												{
													xtype:'tabpanel',
													activeTab: 0,
													defaults:{autoHeight:true, bodyStyle:'padding:10px'}, 
													border: false,
													items:
															[
																{
																	title:'ARCHIVOS DE VENTAS',
																	border: false,
																	html:'<iframe id="InfoD" name="InfoD" src="report-genecomision.php?archivo='+id_archivo+'" height="505" width="100%" scrolling="no" frameborder="0"style="background-color:#ffffff; border-style:solid; border-color:#99BBE8; border-width:1px;"></iframe>'
																},
																{
																	title:'DETALLE DE VENTAS',
																	border: false,
																	html:'<iframe id="InfoE" name="InfoE" src="http://www.google.com" height="505" width="100%" scrolling="no" frameborder="0"style="background-color:#ffffff; border-style:solid; border-color:#99BBE8; border-width:1px;"></iframe>'
																}
															]
												}
											]
								});
		
							}
		window_config.show();
		}
</script>
  
  
  <!-- 	Estilo interno -->
  <style type="text/css">
  body,td,th {
  font-family: Verdana, Arial,Helvetica,Geneva, sans-serif;
  }
  </style>
  <link href="../style/style2.css" rel="stylesheet" type="text/css">
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#d9e7f8" onload="enviar('bienvenidos.php')">
<table width="1025" border="0"  cellpadding="0" cellspacing="0" align="center">
  <tr>
	<td bgcolor="#FFFFFF">
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
			<tr> 
				<td height="65" valign="top" class="bgHead"> 
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr> 
							<td width="102" height="65" valign="bottom" class="bgCornerTop"><img src="../images/bg_corner_top_2.gif" width="102" height="65"></td>
							<td height="65" width="250" align="left"><div id="logo"><img src="../images/SYSFLOT.gif" width="169" height="56" border="0">&COPY;</div></td>
							<td align="right" valign="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
							<td colspan="2" align="right" valign="bottom">
							<span style="color:#2c3481; padding-left: 15px; font-size: 10px;"><?=$_SESSION["NOMBREUSUARIO"]?></span><br>
							<a href="javascript:Alert_Bloq();"><img src="../fk_skin/images_encabezado/header_11.png" width="32" height="32" alt="" title="<?=Title_bloquear?>"></a>
							<a href="javascript:top.window.location='../cerrarsession.php?cerrar=true'"><img src="../fk_skin/images_encabezado/header_10-14.png" alt="" width="32" height="32" border="0" title="<?=TitleAdmin_028?>"></a>
							</td>
							<td align="center" valign="center"><img src="../images/logo1.gif"  height="56" alt=""></td>
						</tr>
					</table>
				</td>
			</tr>
			<tr> 
				<td height="47" valign="top" class="bgMenuBack">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr> 
							<td colspan="2"><img src="../images/bg_corner_bot_2.gif" width="121" height="47"> <img src="../images/spacer.gif" width="10" height="1"></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</td>
  </tr>
  <tr>
    <td>
    <!-- CUERPO -->
        <table width="1025" border="0" cellpadding="0" cellspacing="0" style="background-color:#D9E7F8; border-style:solid; border-color:#99BBE8; border-width:2px;">
          <tr>
            <td>
            <div id='Panel' style="width:200px; padding-left:10px; padding-right:10px;"></div>            
            </td>
            <td align="right">
			    <iframe id="InfoC" name="InfoC" src="" height="505" width="796" scrolling="no" frameborder="0"style="background-color:#ffffff; border-style:solid; border-color:#99BBE8; border-width:1px;"></iframe>
		    
			</td>
          </tr>
        </table>
    <!-- FIN CUERPO -->
    </td>
  </tr>
  <tr>
    <td>
    <!-- Pie-de-pagina -->
      <table id="Table_pie-de-pagina" bgcolor="#FFFFFF" height="35" border="0" width="100%" cellpadding="0" cellspacing="0">
          <tr>
              <td  height="35" align="center" valign="middle" style="font-size: 13px;" ><?=Title_piepag?></td>
          </tr>
      </table>
     <!-- End Pie-de-pagina -->  
    </td>
  </tr>
</table>
</body>
</html>